const fs = require('fs');  
const path = require("path")
const { app } = require("electron");
const Koa = require('koa')
const Router = require('koa-router') 
const { koaBody } = require('koa-body');
const cors = require('@koa/cors')   
const koa = new Koa() 
const router = require('./routes/index');
 
koa.use(koaBody()) 
koa.use(cors())
koa.use(router.routes(), router.allowedMethods());
// https://github1s.com/tugenhua0707/node-demo/blob/master/routers/routes/index.js 
module.exports = {
    run(){
        return koa.listen(10086)
    },
    stop(){
       //fs.writeFileSync(filepath,JSON.stringify(all))
    }
}